package com.example.frn.dao;

import com.example.frn.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
   @Select("select * from user where username=#{param} and is_delete!=1")
    User selectUserByUsername(String username);

    @Insert("insert into User(username,passwd,nick_name,phone,email,avatar) value (#{username},#{passwd},#{nickName}," +
            "#{phone},#{email},#{avatar})")
    int insert(User user);

    int updateById(User user);
    @Update("update user set is_delete=1 where id=#{id}")
    int deleteById(Integer id);
    @Update("update user set passwd=#{passwd} where id=#{id}")
    int updatePasswd(User user);
    @Update("update user set no_speak_status=#{noSpeakStatus},no_speak_time=#{noSpeakTime} where id=#{id}")
    int updateNoSpeakStatus(User user);
    @Select("select * from user where is_delete = 0 and id = #{param}")
    User selectById(Integer id);


    List<User> List(@Param("username") String username,@Param("nickName") String nickName);

}
